package com.company;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;


/**
 * @author Administrator
 */
public class HJ3明明的随机数 {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;
        // while ((str = br.readLine()) != null) {
        // boolean[] stu = new boolean[1001];
        // StringBuilder sb = new StringBuilder();
        // int n = Integer.valueOf(str);
        // for (int i = 0; i < n; i++)
        // stu[Integer.valueOf(br.readLine())] = true;
        // for (int i = 1; i < 1001; i++) {
        // if (stu[i]) {
        // sb.append(i);
        // sb.append("\n");
        // }
        // }
        // sb.deleteCharAt(sb.length() - 1);
        // System.out.println(sb.toString());
        // }

        Scanner input = new Scanner(System.in);
        while (input.hasNext()) {
            ArrayList<Integer> list = new ArrayList<>();
            int nextInt = input.nextInt();
            for (int i = 0; i < nextInt; i++) {
                list.add(input.nextInt());
            }
            Stream<Object> sorted = Arrays.stream(list.stream().distinct().toArray()).sorted();
            // sorted.forEach(System.out::println);

            //Collections.sort(list);

            final Integer[] ts = list.toArray(new Integer[0]);
            for (int i = 0; i < ts.length; i++) {
                System.out.println(ts[i]);
            }

            Arrays.sort(ts);
            for (int i = 0; i < ts.length; i++) {
                System.out.println(ts[i]);
            }

        }
    }
}
